package com.bestcem.xm.ticket.service.manager.record;

import com.bestcem.xm.ticket.entity.mongo.TicketRecord;
import com.bestcem.xm.ticket.service.manager.record.param.TransferTicketRecordParam;
import lombok.Getter;

import java.util.Objects;

/**
 * 转派工单参数
 *
 * @author liheng
 * @author XiaoYunSong <ys.xiao@idiaoyan.com> 新增组织转派相关参数
 * @version v1.0
 * @date 2021/9/9 14:39
 */
@Getter
public class TransferTicketRecord extends BaseTicketRecord {
    /**
     * 接受工单的用户id
     */
    private final String receiveUserId;
    /**
     * 接受工单的用户姓名
     */
    private final String receiveUsername;
    /**
     * 接受工单的角色id
     */
    private final String receiveRoleId;
    /**
     * 接受工单的角色名
     */
    private final String receiveRoleName;
    /**
     * 接受工单的组织id
     */
    private final String receiveGroupId;
    /**
     * 接受工单的组织名
     */
    private final String receiveGroupName;
    /**
     * 接受工单的层级id
     */
    private final String receiveGroupLevelId;
    /**
     * 接受工单的层级名
     */
    private final String receiveGroupLevelName;


    private TransferTicketRecord(TransferTicketRecordParam param) {
        super(param);
        this.receiveUserId = param.getReceiveUserId();
        this.receiveUsername = param.getReceiveUsername();
        this.receiveRoleId = param.getReceiveRoleId();
        this.receiveRoleName = param.getReceiveRoleName();
        this.receiveGroupId = param.getReceiveGroupId();
        this.receiveGroupName = param.getReceiveGroupName();
        this.receiveGroupLevelId = param.getReceiveGroupLevelId();
        this.receiveGroupLevelName = param.getReceiveGroupLevelName();
    }

    public static TransferTicketRecord getInstance(TransferTicketRecordParam param) {
        if (Objects.isNull(param)) {
            return null;
        }
        return new TransferTicketRecord(param);
    }

    @Override
    TicketRecord.CustomAttr customAttr() {
        return new TicketRecord.CustomAttr();
    }
}
